package com.cn.zpark;

import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @PackageName: com.cn.zpark
 * @ClassName: JdbcDriverRge
 * @Description:JDBC注册驱动
 * @author: RZS
 * @date: 2022/3/29  19:42
 */
public class JdbcDriverRge {
    // psvm
    public static void main(String[] args) {
        // 注册驱动
        try {
            DriverManager.registerDriver(new com.mysql.jdbc.Driver());
        } catch (SQLException e) {
            e.printStackTrace();
        }
        System.out.println("驱动注册成功");

        // 通过反射注册驱动
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        System.out.println("驱动注册成功");
    }
}
